import unittest
from time import sleep
from selenium import webdriver


class compatibility_Test(unittest.TestCase):

    def setUp(self):
        self.url = "http://cn.bing.com"

    def search_string(self, driver):
        driver.get(self.url)
        driver.find_element_by_id("sb_form_q").send_keys("助学金")
        driver.find_element_by_css_selector("#search_icon > svg").click()
        sleep(2)

    def test_chrome(self):
        self.driver = webdriver.Chrome()
        self.search_string(self.driver)
        print("正在用chrome进行测试。。。")

    def test_firefox(self):
        self.driver = webdriver.Firefox()
        self.search_string(self.driver)
        print("正在用Firefox进行测试。。。")

    def tearDown(self):
        self.driver.quit()
        print("测试结束")


if __name__ == "__main__":
    unittest.main()























